package com.fwj.designmodelexample.observeddemo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author stone.feng
 * @since 2019-03-04
 */
public class Cat implements Subject {

    List<Observer> list = new ArrayList<>();

    @Override
    public void addObserver(Observer obj) {
        list.add(obj);
    }

    void cry() {
        System.out.println("猫叫了.......");
        for (Observer obj : list
        ) {
            obj.response();
        }
    }
}